<%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2020/2/6
  Time: 19:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
</head>
<body>
<span id="path" hidden>${APP_PATH}/</span>
<input type="hidden" id="uid" value="${sessionScope.user.uid}"/>
<span id="loginHref" hidden>${APP_PATH}/toPortalLogin</span>
<span id="insertHref" hidden>${APP_PATH}/order/insertPre_order</span>
<div class="proDets">
    <img class="off" src="${APP_PATH}/portal/img/temp/off.jpg" />
    <div class="tit clearfix">
        <h4 id="fname" class="fl"></h4>
        <span id="fprice" class="fr"></span>
    </div>
    <div class="proCon clearfix">
        <div class="proImg fl">
            <img id="fface" style="width:360px;" class="list" src=""  />
            <div id="FKface" class="smallImg clearfix">
            </div>
        </div>
        <div class="fr">
            <div class="proIntro">
                <p>颜色分类</p>
                <div id="FK" class="smallImg clearfix categ">
                </div>
                <p>数量&nbsp;&nbsp;库存&nbsp;<span id="stock"></span>&nbsp;件</p>
                <div class="num clearfix">
                    <img class="fl sub" src="${APP_PATH}/portal/img/temp/sub.jpg">
                    <span id="num" class="fl" contentEditable="true">1</span>
                    <img class="fl add" src="${APP_PATH}/portal/img/temp/add.jpg">
                    <p class="please fl">请选择商品属性!</p>
                </div>
            </div>
            <div class="btns clearfix">
                <a href="#2"><p class="buy fl">立即购买</p></a>
                <a href="#2"><p class="cart fr">加入购物车</p></a>
            </div>
        </div>
    </div>
    <a id="toFurnitureDetail" class="more" href="">查看更多细节</a>
</div>

</body>
</html>

<script>
    function getSkimmingInfo(fid){
        $.ajax({
            url : "${APP_PATH}/goods/getFurnitureDetail",
            method : "GET",
            data : {
                fid : fid
            },
            success : function (result) {
                if(result.success){
                    var furniture = result.data.furniture;
                    var viewList = result.data.viewList;
                    var detailList = result.data.detailList;
                    var furnitureKindsList = result.data.furnitureKindsList;
                    $("#fname").html(""+furniture.fname);
                    $("#fprice").html("￥ "+furniture.fprice.toFixed(2));
                    $("#fface").attr("src","${APP_PATH}/"+furniture.fface);
                    $("#toFurnitureDetail").attr("href","${APP_PATH}/toFurnitureDetail?fid="+furniture.fid+"&ktid="+furniture.kt_ktid);
                    var FKContent = "";
                    var FKface = "";
                    for(var i = 0; i < furnitureKindsList.length; i++){

                        FKContent += '<p id="'+furnitureKindsList[i].fkid+'" class="fl"><img id="'+furnitureKindsList[i].stock+'" src="${APP_PATH}/'+furnitureKindsList[i].fkface+'" alt="'+furnitureKindsList[i].fkname+'" data-src="${APP_PATH}/'+furnitureKindsList[i].fkface+'"></p>';
                        FKface +=  '<img src="${APP_PATH}/'+furnitureKindsList[i].fkface+'" data-src="${APP_PATH}/'+furnitureKindsList[i].fkface+'">';
                    }
                    $("#FK").html(FKContent);
                    $("#FKface").html(FKface);
                    $("#FK").find(".fl").click(function () {
                        var stock = $(this).find("img").attr("id");
                        if(stock == '0'){
                            stock = '已售完';
                        }
                        $("#stock").html(stock);
                    });
                    proRender();
                }
            },
            complete :function () {
                $(".mask").show();
                $(".proDets").show();
            }
        });
    }
</script>